package string;

public class StringDemo {

    public static void main(String[] args) {
        String name="ww";
        String WW=new String("ww");
        String W="W";
        String W1=W+"W";
        System.out.println(name.equals(WW));
        System.out.println(name==WW);
        System.out.println(W1==WW);
        System.out.println(W1.equals(WW));













        /*  String  name="rr";
          String  name1="rr";
          String  name2="rr";
        System.out.println(name==name1);
        System.out.println(name1==name2);
        System.out.println(name==name2);
        name=name+"j";
        System.out.println(name==name1);
        String s1="123abc"; //创建一个地址
        String s2="123"+"abc";
        System.out.println(s1==s2);
        String s3="123";
        String s4=s3+"abc";//创建一个新的对象存储123abc 地址改变
        System.out.println(s1==s4);//结果地址发生改变，所以false
*/








    }
}
